package com.zzy.demo.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zzy.cms.core.util.json.FastJsonUtil;
import com.zzy.demo.common.constant.SessionConstant;
import com.zzy.demo.common.dto.user.UserDto;

/**
 * 
 * @author guokaige
 *
 */
@Controller
public class IndexController {


	@RequestMapping({ "/", "/index" })
	public String index(HttpServletRequest request, ModelMap modelMap) {
		Object userObj = request.getSession().getAttribute(SessionConstant.USER);
		if(null!=userObj) {
			UserDto sessionUser = FastJsonUtil.unFastJsonSerialize(userObj.toString(), UserDto.class);
			if(null != sessionUser) {
				modelMap.put("session_user", sessionUser);
			}
		}
		return "/guide/index";
	}

	
	/**
	 * http://www.itxst.com/sortablejs/neuinffi.html
	 * @return
	 */
	@RequestMapping({ "/sortable" })
	public String Sortable() {
		return "/test/Sortable";
	}

}
